Data warehouse systems may maintain datasets comprising a number of structurally related tables. For example, sales data for the previous twelve months might be kept in a collection of twelve tables, each containing data corresponding to a particular month. As time passes, the oldest table might be dropped and a new table, representing the current month, might be added. Data maintained in this manner may be queried through the use of structured query language (“SQL”) statements that include union clauses to indicate that rows from multiple tables should be joined together. The SQL statements may also include clauses indicating a sort order and a limit on the number of rows that are to be returned. SQL statements of this sort may be used for reporting functions, such as selecting the top ten selling products over the last twelve months.
The aforementioned table structure and SQL statements are commonly employed. However, large data warehouse systems may not necessarily store data in a manner that corresponds directly to the table-oriented structure just described. For example, a table may itself be further broken down into segments known as partitions. Furthermore, for various reasons it may be difficult to efficiently process SQL statements on the partitioned data. One reason is that SQL statements and clauses have semantics that operate on tables or at higher levels, such as on subqueries. SQL semantics are not generally aware of partition-level operations.